package com.newenergy.wisehome.gateway.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.newenergy.wisehome.R;

import cn.com.broadlink.family.params.BLFamilyInfo;

public class BLFamilyAdapter  extends RecyclerArrayAdapter<BLFamilyInfo> {

    public BLFamilyAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int
            viewType) {
        return new ViewHolder(parent);
    }

    private class ViewHolder extends BaseViewHolder<BLFamilyInfo> {
        private TextView tvTitle;
        private TextView tvSubTitle;

        public ViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_bl_family);
            tvTitle = $(R.id.tv_name);
            tvSubTitle = $(R.id.tv_id);
        }
        @Override
        public void setData(BLFamilyInfo data) {
            super.setData(data);
            tvTitle.setText(data.getFamilyName());
            tvSubTitle.setText(data.getFamilyId());
        }
    }
}
